package com.risk.modules.rm.dao;

import com.sx.sx.business.entities.DataLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface DataLogDao {
    @Insert(value="INSERT INTO `data_log`(`id`, `name`, `id_card`, `mobile`, `bank_card`, `rule_id`, `scope_id`," +
            "`user_id`, `request_url`, `request`, `response`, `response_time`, `create_by`, `create_time`, `update_by`, `update_time`) " +
            "VALUES (#{dataLog.id}, #{dataLog.name}, #{dataLog.idCard}, #{dataLog.mobile}, #{dataLog.bankCard}, #{dataLog.ruleId}, #{dataLog.scopeId}, #{dataLog.userId}," +
            " #{dataLog.requestUrl}, #{dataLog.request}, #{dataLog.response}, #{dataLog.responseTime}, #{dataLog.createBy}, #{dataLog.createTime}, #{dataLog.updateBy}, " +
            "#{dataLog.updateTime})")
    int add(@Param("dataLog") DataLog dataLog);

    @Select(value = "SELECT * FROM `data_log` WHERE 1 = 1 ${whereClause}  ORDER BY create_time")
    List<DataLog> pageByCondition(@Param("whereClause") String whereClause);
}
